.class public Lcom/estrongs/android/pop/esclasses/ESTextView;
.super Landroidx/appcompat/widget/AppCompatTextView;
.source "ESTextView.java"


# instance fields
.field private a:Ljava/lang/String;

.field private b:Ljava/lang/String;

.field private c:Ljava/lang/String;

.field private d:I

.field private e:Z


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 0

    .line 1
    invoke-direct {p0, p1}, Landroidx/appcompat/widget/AppCompatTextView;-><init>(Landroid/content/Context;)V

    const/4 p1, 0x0

    .line 2
    iput p1, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->d:I

    .line 3
    iput-boolean p1, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->e:Z

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 0

    .line 4
    invoke-direct {p0, p1, p2}, Landroidx/appcompat/widget/AppCompatTextView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    const/4 p1, 0x0

    .line 5
    iput p1, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->d:I

    .line 6
    iput-boolean p1, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->e:Z

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 0

    .line 7
    invoke-direct {p0, p1, p2, p3}, Landroidx/appcompat/widget/AppCompatTextView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    const/4 p1, 0x0

    .line 8
    iput p1, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->d:I

    .line 9
    iput-boolean p1, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->e:Z

    return-void
.end method

.method private a(I)Ljava/lang/String;
    .locals 9

    .line 4
    invoke-virtual {p0}, Landroid/widget/TextView;->getPaint()Landroid/text/TextPaint;

    move-result-object v0

    .line 5
    iget-object v1, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->a:Ljava/lang/String;

    const/4 v2, 0x0

    if-eqz v1, :cond_0

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->measureText(Ljava/lang/String;)F

    move-result v1

    float-to-int v1, v1

    goto :goto_0

    :cond_0
    const/4 v1, 0x0

    .line 6
    :goto_0
    iget-object v3, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->b:Ljava/lang/String;

    if-eqz v3, :cond_1

    invoke-virtual {v0, v3}, Landroid/graphics/Paint;->measureText(Ljava/lang/String;)F

    move-result v3

    float-to-int v3, v3

    goto :goto_1

    :cond_1
    const/4 v3, 0x0

    .line 7
    :goto_1
    iget-object v4, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->c:Ljava/lang/String;

    if-eqz v4, :cond_2

    invoke-virtual {v0, v4}, Landroid/graphics/Paint;->measureText(Ljava/lang/String;)F

    move-result v4

    float-to-int v4, v4

    goto :goto_2

    :cond_2
    const/4 v4, 0x0

    :goto_2
    if-nez v3, :cond_3

    if-nez v4, :cond_3

    .line 8
    iget-object p1, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->a:Ljava/lang/String;

    return-object p1

    :cond_3
    const-string v3, " "

    .line 9
    invoke-virtual {v0, v3}, Landroid/graphics/Paint;->measureText(Ljava/lang/String;)F

    move-result v3

    float-to-int v3, v3

    .line 10
    div-int/lit8 v5, p1, 0x3

    .line 11
    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    sub-int v7, v5, v1

    add-int/lit8 v7, v7, -0x1

    .line 12
    div-int/2addr v7, v3

    const/16 v8, 0x20

    if-lez v7, :cond_5

    .line 13
    invoke-static {}, Lcom/estrongs/android/pop/esclasses/g;->a()Z

    move-result v1

    if-eqz v1, :cond_4

    .line 14
    iget-object v1, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->c:Ljava/lang/String;

    invoke-virtual {v6, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    goto :goto_3

    .line 15
    :cond_4
    iget-object v1, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->a:Ljava/lang/String;

    invoke-virtual {v6, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    :goto_3
    const/4 v1, 0x0

    :goto_4
    if-ge v1, v7, :cond_7

    .line 16
    invoke-virtual {v6, v8}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    add-int/lit8 v1, v1, 0x1

    goto :goto_4

    .line 17
    :cond_5
    invoke-static {}, Lcom/estrongs/android/pop/esclasses/g;->a()Z

    move-result v7

    if-eqz v7, :cond_6

    .line 18
    iget-object v7, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->c:Ljava/lang/String;

    invoke-direct {p0, v7, v5, v1}, Lcom/estrongs/android/pop/esclasses/ESTextView;->a(Ljava/lang/String;II)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v6, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 19
    invoke-virtual {v6, v8}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    goto :goto_5

    .line 20
    :cond_6
    iget-object v7, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->a:Ljava/lang/String;

    invoke-direct {p0, v7, v5, v1}, Lcom/estrongs/android/pop/esclasses/ESTextView;->a(Ljava/lang/String;II)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v6, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 21
    invoke-virtual {v6, v8}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    .line 22
    :cond_7
    :goto_5
    invoke-virtual {v6, v8}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    .line 23
    iget-object v1, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->b:Ljava/lang/String;

    invoke-virtual {v6, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 24
    invoke-virtual {v6, v8}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    .line 25
    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->measureText(Ljava/lang/String;)F

    move-result v0

    float-to-int v0, v0

    sub-int/2addr p1, v0

    sub-int v0, p1, v4

    add-int/lit8 v0, v0, -0x1

    .line 26
    div-int/2addr v0, v3

    if-lez v0, :cond_a

    :goto_6
    if-ge v2, v0, :cond_8

    .line 27
    invoke-virtual {v6, v8}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    add-int/lit8 v2, v2, 0x1

    goto :goto_6

    .line 28
    :cond_8
    invoke-static {}, Lcom/estrongs/android/pop/esclasses/g;->a()Z

    move-result p1

    if-eqz p1, :cond_9

    .line 29
    iget-object p1, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->a:Ljava/lang/String;

    invoke-virtual {v6, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    goto :goto_7

    .line 30
    :cond_9
    iget-object p1, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->c:Ljava/lang/String;

    invoke-virtual {v6, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    goto :goto_7

    .line 31
    :cond_a
    invoke-static {}, Lcom/estrongs/android/pop/esclasses/g;->a()Z

    move-result v0

    if-eqz v0, :cond_b

    .line 32
    iget-object v0, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->a:Ljava/lang/String;

    invoke-direct {p0, v0, p1, v4}, Lcom/estrongs/android/pop/esclasses/ESTextView;->a(Ljava/lang/String;II)Ljava/lang/String;

    move-result-object p1

    invoke-virtual {v6, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 33
    invoke-virtual {v6, v8}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    goto :goto_7

    .line 34
    :cond_b
    iget-object v0, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->c:Ljava/lang/String;

    invoke-direct {p0, v0, p1, v4}, Lcom/estrongs/android/pop/esclasses/ESTextView;->a(Ljava/lang/String;II)Ljava/lang/String;

    move-result-object p1

    invoke-virtual {v6, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 35
    invoke-virtual {v6, v8}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    .line 36
    :goto_7
    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    return-object p1
.end method

.method private a(Ljava/lang/String;II)Ljava/lang/String;
    .locals 1

    if-le p3, p2, :cond_0

    .line 1
    invoke-virtual {p1}, Ljava/lang/String;->length()I

    move-result v0

    div-int/2addr p3, v0

    .line 2
    div-int/2addr p2, p3

    add-int/lit8 p2, p2, -0x2

    .line 3
    :try_start_0
    new-instance p3, Ljava/lang/StringBuilder;

    invoke-direct {p3}, Ljava/lang/StringBuilder;-><init>()V

    const/4 v0, 0x0

    invoke-virtual {p1, v0, p2}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object p2

    invoke-virtual {p3, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string p2, "..."

    invoke-virtual {p3, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :catch_0
    :cond_0
    return-object p1
.end method


# virtual methods
.method public a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    .locals 1

    const/4 v0, 0x0

    .line 37
    invoke-virtual {p0, v0}, Landroid/widget/TextView;->setEllipsize(Landroid/text/TextUtils$TruncateAt;)V

    .line 38
    iput-object p1, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->a:Ljava/lang/String;

    .line 39
    iput-object p2, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->b:Ljava/lang/String;

    .line 40
    iput-object p3, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->c:Ljava/lang/String;

    const/4 p1, 0x0

    .line 41
    iput p1, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->d:I

    const/4 p1, 0x1

    .line 42
    iput-boolean p1, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->e:Z

    .line 43
    invoke-virtual {p0}, Landroid/widget/TextView;->invalidate()V

    return-void
.end method

.method public onDraw(Landroid/graphics/Canvas;)V
    .locals 4

    .line 1
    iget-boolean v0, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->e:Z

    if-eqz v0, :cond_0

    .line 2
    invoke-virtual {p0}, Landroid/widget/TextView;->getWidth()I

    move-result v0

    .line 3
    iget v1, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->d:I

    if-eq v0, v1, :cond_0

    .line 4
    :try_start_0
    invoke-virtual {p0}, Landroid/widget/TextView;->getPaddingLeft()I

    move-result v1

    sub-int v1, v0, v1

    invoke-virtual {p0}, Landroid/widget/TextView;->getPaddingRight()I

    move-result v2

    sub-int/2addr v1, v2

    invoke-direct {p0, v1}, Lcom/estrongs/android/pop/esclasses/ESTextView;->a(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 5
    :catch_0
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    .line 6
    iget-object v2, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->a:Ljava/lang/String;

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v2, "  "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-object v3, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->b:Ljava/lang/String;

    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-object v2, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->c:Ljava/lang/String;

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 7
    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 8
    :goto_0
    iput v0, p0, Lcom/estrongs/android/pop/esclasses/ESTextView;->d:I

    .line 9
    :cond_0
    invoke-super {p0, p1}, Landroid/widget/TextView;->onDraw(Landroid/graphics/Canvas;)V

    return-void
.end method
